extends PlayerStatusBase

func start() ->void:
	actor.play_animation("wall_sliding")

# Called when the node enters the scene tree for the first time.
func run_physics_process(delta:float) -> void:
	var collision_info = actor.move_and_collision_info()
	if collision_info.get("is_on_floor"):
		if actor.velocity.x == 0:
			return change_status("Idle")
		else:
			return change_status("Run")
		
	if not collision_info.get("is_on_wall"):
		return change_status("Fall")
	else:
		if actor.can_jump_on_wall():
			return change_to_walljump(actor.get_wall_normal().x)
# Called every frame. 'delta' is the elapsed time since the previous frame.

func run_process(delta: float) -> void:
	wall_slide_velocity(delta)

func wall_slide_velocity(delta:float)->void:
	if actor.is_on_wall():
		var wall_direction = actor.get_wall_normal().x
		actor.velocity.y = blackboard.WALL_SLIDE_SPEED
		actor.velocity.x = -wall_direction  
		actor.graphics.scale.x = wall_direction
	else:
		move_y(delta)
